Change in openvpn[master]: rework all occurrences of 'M_ERR | M_ERRNO'
A message that is not in the archive (sent off-list or not yet received): gerrit.1770799998000.I14395665f197349e374a81b56f28536ff88937a8@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email
to review the following change.
Change subject: rework all occurrences of 'M_ERR | M_ERRNO'
......................................................................
rework all occurrences of 'M_ERR | M_ERRNO'
M_ERR is defined as (M_FATAL | M_ERRNO), so 'msg(M_ERR | M_ERRNO, ...)' is just the same as 'msg(M_ERR, ...)'.
The occurances in tun.c and dco_freebsd.c are really "if this happens, we can not go on" errors, so 'M_ERR' (= FATAL, plus log errno string) is the correct thing to do.
The occurances in dns.c do come with error handling and cleanup after the msg() call, so the right thing is 'M_WARN | M_ERRNO' instead (warning, plus log errno string).
Github: fixes OpenVPN/openvpn#939
---
M src/openvpn/dco_freebsd.c
M src/openvpn/dns.c
M src/openvpn/tun.c
3 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/17/1517/1
src/openvpn/dco_freebsd.c +4 -4
@@ -177,7 +177,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to create new peer" ); +msg (M_ERR ,"Failed to create new peer" ); }free (drv.ifd_data);
@@ -317,7 +317,7 @@ ret =ioctl (tt->dco.fd,SIOCIFDESTROY , &ifr);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to remove interface %s" , ifr.ifr_name); +msg (M_ERR ,"Failed to remove interface %s" , ifr.ifr_name); } tt->dco.ifname[0 ] =0 ;
@@ -473,7 +473,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to start vpn" ); +msg (M_ERR ,"Failed to start vpn" ); }return ret;
@@ -511,7 +511,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to set key" ); +msg (M_ERR ,"Failed to set key" ); }else {
src/openvpn/dns.c +4 -4
@@ -611,13 +611,13 @@int ack_pipe_fd[2 ];if (pipe (dns_pipe_fd) !=0 ||pipe (ack_pipe_fd) !=0 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to create pipes" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to create pipes" );return false; } updown_runner->pid =fork ();if (updown_runner->pid ==-1 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to fork" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to fork" );close (dns_pipe_fd[0 ]);close (dns_pipe_fd[1 ]);close (ack_pipe_fd[0 ]);
@@ -747,7 +747,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not send dns vars filename" ); +msg (M_WARN |M_ERRNO ,"could not send dns vars filename" ); }break ; }
@@ -762,7 +762,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not receive dns updown status" ); +msg (M_WARN |M_ERRNO ,"could not receive dns updown status" ); }break ; }
src/openvpn/tun.c +1 -1
@@ -3011,7 +3011,7 @@/* Retrieve the assigned interface name. */ if (getsockopt (fd,SYSPROTO_CONTROL ,UTUN_OPT_IFNAME , utunname, &utunname_len)) { -msg (M_ERR |M_ERRNO ,"Error retrieving utun interface name" ); +msg (M_ERR ,"Error retrieving utun interface name" ); } tt->actual_name =string_alloc (utunname,NULL );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I14395665f197349e374a81b56f28536ff88937a8
Gerrit-Change-Number: 1517
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: cron2.
plaisthos has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email )
Change subject: rework all occurrences of 'M_ERR | M_ERRNO'
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I14395665f197349e374a81b56f28536ff88937a8
Gerrit-Change-Number: 1517
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Wed, 11 Feb 2026 11:36:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 rework all occurrences of 'M_ERR | M_ERRNO'
In reply to a message not in the archiveFrom: Gert Doering <[email protected]...>
M_ERR is defined as (M_FATAL | M_ERRNO), so 'msg(M_ERR | M_ERRNO, ...)' is just the same as 'msg(M_ERR, ...)'.
The occurances in tun.c and dco_freebsd.c are really "if this happens, we can not go on" errors, so 'M_ERR' (= FATAL, plus log errno string) is the correct thing to do.
The occurances in dns.c do come with error handling and cleanup after the msg() call, so the right thing is 'M_WARN | M_ERRNO' instead (warning, plus log errno string).
Github: fixes OpenVPN/openvpn#939
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
src/openvpn/dco_freebsd.c +4 -4
@@ -177,7 +177,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to create new peer" ); +msg (M_ERR ,"Failed to create new peer" ); }free (drv.ifd_data);
@@ -317,7 +317,7 @@ ret =ioctl (tt->dco.fd,SIOCIFDESTROY , &ifr);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to remove interface %s" , ifr.ifr_name); +msg (M_ERR ,"Failed to remove interface %s" , ifr.ifr_name); } tt->dco.ifname[0 ] =0 ;
@@ -473,7 +473,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to start vpn" ); +msg (M_ERR ,"Failed to start vpn" ); }return ret;
@@ -511,7 +511,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to set key" ); +msg (M_ERR ,"Failed to set key" ); }else {
src/openvpn/dns.c +4 -4
@@ -611,13 +611,13 @@int ack_pipe_fd[2 ];if (pipe (dns_pipe_fd) !=0 ||pipe (ack_pipe_fd) !=0 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to create pipes" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to create pipes" );return false; } updown_runner->pid =fork ();if (updown_runner->pid ==-1 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to fork" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to fork" );close (dns_pipe_fd[0 ]);close (dns_pipe_fd[1 ]);close (ack_pipe_fd[0 ]);
@@ -747,7 +747,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not send dns vars filename" ); +msg (M_WARN |M_ERRNO ,"could not send dns vars filename" ); }break ; }
@@ -762,7 +762,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not receive dns updown status" ); +msg (M_WARN |M_ERRNO ,"could not receive dns updown status" ); }break ; }
src/openvpn/tun.c +1 -1
@@ -3011,7 +3011,7 @@/* Retrieve the assigned interface name. */ if (getsockopt (fd,SYSPROTO_CONTROL ,UTUN_OPT_IFNAME , utunname, &utunname_len)) { -msg (M_ERR |M_ERRNO ,"Error retrieving utun interface name" ); +msg (M_ERR ,"Error retrieving utun interface name" ); } tt->actual_name =string_alloc (utunname,NULL );
[Openvpn-devel] [PATCH applied] Re: rework all occurrences of 'M_ERR | M_ERRNO'
Thanks for the review.
"Testing" this is somewhat hard (as not all of these error conditions can be triggered at will), but as the patch is fairly straightforward and only affects error-handling branches, "it compiles" is good enough for me ;-)
Your patch has been applied to the master and release/2.7 branch (bugfix).
commit f349b0a61499d3d36e69e2aa4dbbb7692b7d1df8 (master) commit 158f1fa1ef139bad82ecaad284265fecdee6be66 (release/2.7)
Author: Gert Doering Date: Wed Feb 11 16:06:48 2026 +0100
rework all occurrences of 'M_ERR | M_ERRNO'
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35594.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
Change subject: rework all occurrences of 'M_ERR | M_ERRNO'
......................................................................
rework all occurrences of 'M_ERR | M_ERRNO'
M_ERR is defined as (M_FATAL | M_ERRNO), so 'msg(M_ERR | M_ERRNO, ...)' is just the same as 'msg(M_ERR, ...)'.
The occurances in tun.c and dco_freebsd.c are really "if this happens, we can not go on" errors, so 'M_ERR' (= FATAL, plus log errno string) is the correct thing to do.
The occurances in dns.c do come with error handling and cleanup after the msg() call, so the right thing is 'M_WARN | M_ERRNO' instead (warning, plus log errno string).
Github: fixes OpenVPN/openvpn#939
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35594.html
---
M src/openvpn/dco_freebsd.c
M src/openvpn/dns.c
M src/openvpn/tun.c
3 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/17/1517/2
src/openvpn/dco_freebsd.c +4 -4
@@ -177,7 +177,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to create new peer" ); +msg (M_ERR ,"Failed to create new peer" ); }free (drv.ifd_data);
@@ -317,7 +317,7 @@ ret =ioctl (tt->dco.fd,SIOCIFDESTROY , &ifr);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to remove interface %s" , ifr.ifr_name); +msg (M_ERR ,"Failed to remove interface %s" , ifr.ifr_name); } tt->dco.ifname[0 ] =0 ;
@@ -473,7 +473,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to start vpn" ); +msg (M_ERR ,"Failed to start vpn" ); }return ret;
@@ -511,7 +511,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to set key" ); +msg (M_ERR ,"Failed to set key" ); }else {
src/openvpn/dns.c +4 -4
@@ -611,13 +611,13 @@int ack_pipe_fd[2 ];if (pipe (dns_pipe_fd) !=0 ||pipe (ack_pipe_fd) !=0 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to create pipes" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to create pipes" );return false; } updown_runner->pid =fork ();if (updown_runner->pid ==-1 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to fork" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to fork" );close (dns_pipe_fd[0 ]);close (dns_pipe_fd[1 ]);close (ack_pipe_fd[0 ]);
@@ -747,7 +747,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not send dns vars filename" ); +msg (M_WARN |M_ERRNO ,"could not send dns vars filename" ); }break ; }
@@ -762,7 +762,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not receive dns updown status" ); +msg (M_WARN |M_ERRNO ,"could not receive dns updown status" ); }break ; }
src/openvpn/tun.c +1 -1
@@ -3011,7 +3011,7 @@/* Retrieve the assigned interface name. */ if (getsockopt (fd,SYSPROTO_CONTROL ,UTUN_OPT_IFNAME , utunname, &utunname_len)) { -msg (M_ERR |M_ERRNO ,"Error retrieving utun interface name" ); +msg (M_ERR ,"Error retrieving utun interface name" ); } tt->actual_name =string_alloc (utunname,NULL );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I14395665f197349e374a81b56f28536ff88937a8
Gerrit-Change-Number: 1517
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email )
Change subject: rework all occurrences of 'M_ERR | M_ERRNO'
......................................................................
rework all occurrences of 'M_ERR | M_ERRNO'
M_ERR is defined as (M_FATAL | M_ERRNO), so 'msg(M_ERR | M_ERRNO, ...)' is just the same as 'msg(M_ERR, ...)'.
The occurances in tun.c and dco_freebsd.c are really "if this happens, we can not go on" errors, so 'M_ERR' (= FATAL, plus log errno string) is the correct thing to do.
The occurances in dns.c do come with error handling and cleanup after the msg() call, so the right thing is 'M_WARN | M_ERRNO' instead (warning, plus log errno string).
Github: fixes OpenVPN/openvpn#939
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35594.html
---
M src/openvpn/dco_freebsd.c
M src/openvpn/dns.c
M src/openvpn/tun.c
3 files changed, 9 insertions(+), 9 deletions(-)
src/openvpn/dco_freebsd.c +4 -4
@@ -177,7 +177,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to create new peer" ); +msg (M_ERR ,"Failed to create new peer" ); }free (drv.ifd_data);
@@ -317,7 +317,7 @@ ret =ioctl (tt->dco.fd,SIOCIFDESTROY , &ifr);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to remove interface %s" , ifr.ifr_name); +msg (M_ERR ,"Failed to remove interface %s" , ifr.ifr_name); } tt->dco.ifname[0 ] =0 ;
@@ -473,7 +473,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to start vpn" ); +msg (M_ERR ,"Failed to start vpn" ); }return ret;
@@ -511,7 +511,7 @@ ret =ioctl (dco->fd,SIOCSDRVSPEC , &drv);if (ret) { -msg (M_ERR |M_ERRNO ,"Failed to set key" ); +msg (M_ERR ,"Failed to set key" ); }else {
src/openvpn/dns.c +4 -4
@@ -611,13 +611,13 @@int ack_pipe_fd[2 ];if (pipe (dns_pipe_fd) !=0 ||pipe (ack_pipe_fd) !=0 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to create pipes" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to create pipes" );return false; } updown_runner->pid =fork ();if (updown_runner->pid ==-1 ) { -msg (M_ERR |M_ERRNO ,"run_dns_up_down: unable to fork" ); +msg (M_WARN |M_ERRNO ,"run_dns_up_down: unable to fork" );close (dns_pipe_fd[0 ]);close (dns_pipe_fd[1 ]);close (ack_pipe_fd[0 ]);
@@ -747,7 +747,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not send dns vars filename" ); +msg (M_WARN |M_ERRNO ,"could not send dns vars filename" ); }break ; }
@@ -762,7 +762,7 @@ {continue ; } -msg (M_ERR |M_ERRNO ,"could not receive dns updown status" ); +msg (M_WARN |M_ERRNO ,"could not receive dns updown status" ); }break ; }
src/openvpn/tun.c +1 -1
@@ -3011,7 +3011,7 @@/* Retrieve the assigned interface name. */ if (getsockopt (fd,SYSPROTO_CONTROL ,UTUN_OPT_IFNAME , utunname, &utunname_len)) { -msg (M_ERR |M_ERRNO ,"Error retrieving utun interface name" ); +msg (M_ERR ,"Error retrieving utun interface name" ); } tt->actual_name =string_alloc (utunname,NULL );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1517?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I14395665f197349e374a81b56f28536ff88937a8
Gerrit-Change-Number: 1517
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>